#include "folder.h"
#include <fstream>
#include <sys/stat.h> // For mkdir function on Linux
#ifdef _WIN32
#include <direct.h> // For mkdir function on Windows
#endif

bool directoryExists(const std::string &path)
{
#ifdef _WIN32
    struct _stat info;
    if (_stat(path.c_str(), &info) != 0)
    {
        return false;
    }
    return (info.st_mode & _S_IFDIR) != 0;
#else
    struct stat info;
    if (stat(path.c_str(), &info) != 0)
    {
        return false;
    }
    return (info.st_mode & S_IFDIR) != 0;
#endif
}

bool createDirectory(const std::string &path)
{
#ifdef _WIN32
    return _mkdir(path.c_str()) == 0;
#else
    return mkdir(path.c_str(), 0777) == 0;
#endif
}